package controllers;

import com.ebay.sdk.ApiException;
import com.ebay.sdk.SdkException;

import models.*;

public class Security extends Secure.Security {

    //for now, we will hardcode the username & password as below
    static boolean authenticate(String username, String password) {
        if (username.equals("user") && password.equals("pass")) {
            return true;
        }
        return false;
    }

    //send user to index (home page) when they logout
    static void onDisconnected() {
        
    	try {
			Home.index();
		} catch (ApiException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SdkException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }

    //send user to admin area when they login successfully
    static void onAuthenticated(){
        try {
			Seller.index();
		} catch (ApiException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SdkException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
}
